home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 April
/
PCWorld_2008-04_cd.bin
/
v cisle
/
allwaysync
/
allwaysync-7-0-1.exe
/
{app}
/
Skins
/
windows XP
/
options.js
< prev
next >
Wrap
Text File
|
2007-08-21
|
48KB
|
927 lines
//-------------------------------------------------------------------------------------------------------------------
// Main Buttons functions
//-------------------------------------------------------------------------------------------------------------------
// OnClick_Ok()
// OnClick_Cancel()
// OnClick_Apply()
// OnClick_Default()
// Body_onload()
// RefreshButtons(Node)
// ExtModificationNode()
//-------------------------------------------------------------------------------------------------------------------
G_PAPAM_NODE_IS_VISIBLE = false;
function OnClick_Ok()
{
external.Method0('M_OptionsWndOk');
}
function OnClick_Cancel()
{
external.Method0('M_TryToCloseCWnd');
}
function OnClick_Apply()
{
var Node = external.Method0('M_GetOptionTreeRoot');
external.Method0('M_OptionsWndApply');
RefreshButtons(Node);
}
function OnClick_Default()
{
var Node = external.Method0('M_GetOptionTreeRoot');
external.Method1('M_OptionsWndDefault', Node);
RefreshButtons(Node);
}
function RefreshButtons(Node)
{
Button_Ok.value = external.LS('button_ok');
Button_Cancel.value = external.LS('button_cancel');
Button_Default.value = external.LS('button_default');
Button_Apply.value = external.LS('button_apply');
Button_Apply.disabled = !external.Method1('M_IsChangedNode', external.Method0('M_GetOptionTreeRoot'));
if (Button_Apply.disabled == true) Button_Apply.style.cursor = '';
else Button_Apply.style.cursor = 'hand';
Button_Ok.title = external.LS("tooltip_options_Button_Ok");
Button_Cancel.title = external.LS("tooltip_options_Button_Cancel");
Button_Apply.title = external.LS("tooltip_options_Button_Apply");
Button_Default.title = external.LS("tooltip_options_Button_Default");
}
function ExtModificationNode()
{
var Node = external.Method0('M_GetOptionTreeRoot');
var if_modified = external.Method1('M_IsChangedNode', Node);
Button_Apply.disabled = !if_modified;
if (Button_Apply.disabled == true) Button_Apply.style.cursor = '';
else Button_Apply.style.cursor = 'hand';
}
function Body_onload()
{
var Node = external.Method0('M_GetOptionTreeRoot');
ShowPage(Node);
}
function Body_onresize(Body)
{
/*if (window.document.clientWidth < 500) window.document.clientWidth = 500; alert(window.document.clientWidth);*/
}
//-------------------------------------------------------------------------------------------------------------------
// Functions for nodes viewing
//-------------------------------------------------------------------------------------------------------------------
// ShowPage(Node)
// ExtRefreshView(Node, Mode)
// ExtOnCollapsibleNodeButtonClick(Node, ButtonNode)
// ExtFocusToNode(Node)
// MustBeDisabled(Node)
// IsProcessed(Node)
// IsCollapsible(Node)
// OnCollapsibleNodeButtonClick(HtmlElementID, ButtonItem)
//-------------------------------------------------------------------------------------------------------------------
function ShowPage(Node)
{
Page_container.innerHTML = BuildNodeView(Node, 'Left');
RefreshButtons(Node);
}
function ExtRefreshView(Node, Mode)
{
var NodeID = Node.objID;
if (Mode == 0) Mode = 'Node';
else if (Mode == 2) Mode = 'Caption';
else if (Mode == 3) Mode = 'Description';
if (Mode == 'Node')
{
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.ObjID;
var NodeID = Node.ObjID;
if (RootNodeID == NodeID)
{
Page_container.innerHTML = BuildNodeView(Node, 'Left');
}
else
{
var Node_container = document.getElementById(NodeID);
if (Node_container != null) Node_container.outerHTML = BuildNodeView(Node, 'Left');
}
}
else if ((Mode == 'Caption') || (Mode == 'Description'))
{
var NodeSpecification_container = document.getElementById(NodeID+Mode+'');
if (NodeSpecification_container != null) NodeSpecification_container.innerHTML = StrToFormatStr(Node.Method0('M_GetNode'+Mode));
}
RefreshButtons(Node);
}
function ExtOnCollapsibleNodeControlClick(Node, ButtonNode)
{
var HtmlElement = document.getElementById(Node.objID+'CollapsiblePart');
var ButtonElement = document.getElementById(ButtonNode.objID+'Caption');
if (HtmlElement != null)
if ( HtmlElement.className == "Collapsed")
{
HtmlElement.className = "Expanded";
ButtonElement.innerHTML=external.LS('button_basic');
}
else
{
HtmlElement.className = "Collapsed";
ButtonElement.innerHTML=external.LS('button_advanced');
}
}
function ExtFocusToNode(Node)
{
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.objID;
var NodeID = Node.objID;
//-------------------------------------------------------
if(RootNodeID != NodeID)
{
var ParentNode = Node.Method0('M_GetNodeParent');
var ParentNodeID = ParentNode.objID;
var CollapsiblePart_container = document.getElementById(ParentNodeID+'CollapsiblePart');
if (CollapsiblePart_container != null) CollapsiblePart_container.className='Expanded';
var CEButton_container = document.getElementById(ParentNodeID+'CEButton');
if (CEButton_container != null) CEButton_container.src="Pics/Op_Node_Col.gif";
while (ParentNodeID != RootNodeID)
{
ParentNode = ParentNode.Method0('M_GetNodeParent');
ParentNodeID = ParentNode.objID;
var CollapsiblePart_container = document.getElementById(ParentNodeID+'CollapsiblePart');
if (CollapsiblePart_container != null) CollapsiblePart_container.className='Expanded';
var CEButton_container = document.getElementById(ParentNodeID+'CEButton');
if (CEButton_container != null) CEButton_container.src="Pics/Op_Node_Col.gif";
}
}
//-------------------------------------------------------
var NodeType = Node.Method0('M_GetNodeType');
if ((NodeType >=40) && (NodeType < 50))
{
var Node_container = document.getElementById(NodeID+'Value');
Node_container.setActive();
Node_container.select();
}
else
{
var Node_container = document.getElementById(NodeID+'Caption');
Node_container.setActive();
}
}
function MustBeDisabled(Node)
{
var result = false;
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.objID;
var NodeID = Node.objID;
if(RootNodeID != NodeID)
{
var ParentNode = Node.Method0('M_GetNodeParent');
var ParentNodeID = ParentNode.objID;
var NodeType = ParentNode.Method0('M_GetNodeType');
// if Parent is not RadioItem CheckItem and is not CheckItem
while ( !((NodeType >= 70) && (NodeType <80)) && !((NodeType >= 80) && (NodeType <90)) && (ParentNodeID != RootNodeID))
{
ParentNode = ParentNode.Method0('M_GetNodeParent');
ParentNodeID = ParentNode.objID;
NodeType = ParentNode.Method0('M_GetNodeType');
}
// if Parent is RadioItem
if ((NodeType >= 70) && (NodeType <80))
{
var GrandFatherNode = ParentNode.Method0('M_GetNodeParent');
if(GrandFatherNode.Method0('M_GetNodeValue')!=ParentNode.Method0('M_GetNodeValue')) {result = true;}
}
// if Parent is CheckItem
else if((NodeType >= 80) && (NodeType <90))
{
var GrandFatherNode = ParentNode.Method0('M_GetNodeParent');
if(ParentNode.Method0('M_GetNodeValue') == 0) {result = true;}
}
}
return result;
}
function IsProcessed(Node)
{
var result = true;
if (Node.Method0('M_GetNodeType') == 0) result = false;
return result;
}
function IsCollapsible(Node)
{
var result = '';
if (Node.Method0('M_GetCollapsibleState') == 0) result = 'No';
if (Node.Method0('M_GetCollapsibleState') == 1) result = 'Auto';
if (Node.Method0('M_GetCollapsibleState') == 2) result = 'Manual';
return result;
}
function OnCollapsibleNodeButtonClick(HtmlElementID, ButtonItem)
{
var HtmlElement = document.getElementById(HtmlElementID);
if (HtmlElement != null)
if ( HtmlElement.className == "Collapsed") { HtmlElement.className = "Expanded"; ButtonItem.src="Pics/Op_Node_Col.gif";}
else { HtmlElement.className = "Collapsed"; ButtonItem.src="Pics/Op_Node_Exp.gif";}
}
//-------------------------------------------------------------------------------------------------------------------
// Accessory functions
//-------------------------------------------------------------------------------------------------------------------
// ExtEditString(Str, Caption)
//-------------------------------------------------------------------------------------------------------------------
function ExtEditString(Str, Caption)
{
var NewStr = '';
var NewStr = prompt(Caption, Str);
return NewStr;
}
//-------------------------------------------------------------------------------------------------------------------
// functions for nodes html-tree making
//-------------------------------------------------------------------------------------------------------------------
// BuildAllChildrenView(Node, Direction, Shift)
// BuildNodeView(Node, Align)
// BuildNodeSpecificationView(Node, Class, Mode, NodeViewType)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildInputItemView(Node, Mode, ParamCount)
// OnInputItemClick(HtmlElement)
// OnInputItemKeyPressed(evt, HtmlElement, NodeID)
// SaveInputItemValue(HtmlElement, NodeID)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildTextItemView(Node, Mode, ItemType, ParamCount, Align)
// OnNodeLinkItemClick(NodeID)
// OnNodeLinkItemMouseOver(ElementID, NodeID, Mode)
// OnNodeLinkItemMouseOut(ElementID, NodeID, Mode)
// TitleItemLevel(NodeID)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildButtonItemView(Node, Mode)
// OnNodeButtonItemClick(NodeID)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildListBoxView(Node, Mode, VSize, FieldSet, Align)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildSimpleBoxView(Node, Align, Rows, ParamCount)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// BuildSimpleBoxItemView(Node, Mode, NodeType, ParamCount)
// OnSimpleBoxItemValueChange(NodeID, CheckItem, Mode)
//-------------------------------------------------------------------------------------------------------------------
function BuildAllChildrenView(Node, Direction, Shift)
{
var html_item = '';
var child_node = Node.GetFirst();
if (child_node != null)
{
var count = 0;
while ((child_node != null) && (count<Shift))
{
if (IsProcessed(child_node)) count++;
child_node = Node.GetNext(child_node);
}
}
if(child_node != null)
{
if (IsCollapsible(Node) != 'No') html_item += '<label id=\''+Node.objID+'CollapsiblePart'+'\' class="Collapsed" >';
if (Direction == 'Horizontal') html_item += '<table><tbody><tr>';
while(child_node != null)
{
if (IsProcessed(child_node))
{
if (Direction == 'Horizontal') html_item += '<td width="33%">' + BuildNodeView(child_node, 'Left') + '</td>';
else html_item += BuildNodeView(child_node, 'Left');
}
child_node = Node.GetNext(child_node);
}
if (Direction == 'Horizontal') html_item += '</tr></tbody></table>';
if (IsCollapsible(Node) != 'No') html_item += '</label>';
}
return html_item;
}
//--------------------------------------------------------------------------------------------------------------------
function BuildNodeView(Node, Align)
{
var Permission = '';
if(MustBeDisabled(Node)) Permission = 'disabled';
var NodeViewType = Node.Method0('M_GetNodeType');
var node_class='';
//-------------------------------------------------------------------------------------------------
if ((NodeViewType >= 10) && (NodeViewType < 30)) node_class = 'TIND'; // TextItem
else if ((NodeViewType >= 30) && (NodeViewType < 40)) node_class = 'TIND'; // LinkItem
else if ((NodeViewType >= 40) && (NodeViewType < 50)) node_class = 'IBND'; // InputItem
else if ((NodeViewType >= 50) && (NodeViewType < 60)) node_class = 'BIND'; // ButtonItem
else if ((NodeViewType >= 60) && (NodeViewType < 70)) node_class = 'SBND'; // SimpleBox
else if ((NodeViewType >= 70) && (NodeViewType < 80)) node_class = 'RIND'; // RadioItem
else if ((NodeViewType >= 80) && (NodeViewType < 90)) node_class = 'CIND'; // CheckItem
else if ((NodeViewType >= 90) && (NodeViewType <100)) node_class = 'LBND'; // CheckItem
//-------------------------------------------------------------------------------------------------
var html_item = '<label id=\''+Node.objID+'\' class=\''+node_class+'\' '+Permission+'>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (NodeViewType == 10 ) html_item += BuildTextItemView (Node, Permission, 'TextItem', 0, 'Left' ); // Left_______TextItem
else if (NodeViewType == 11 ) html_item += BuildTextItemView (Node, Permission, 'TextItem', 1, 'Left' ); // Param1Left_______TextItem
else if (NodeViewType == 12 ) html_item += BuildTextItemView (Node, Permission, 'SimpleTextItem', 0, 'Left' ); // Left_SimpleTextItem
else if (NodeViewType == 13 ) html_item += BuildTextItemView (Node, Permission, 'SimpleTextItem', 1, 'Left' ); // Param1Left_SimpleTextItem
else if (NodeViewType == 14 ) html_item += BuildTextItemView (Node, Permission, 'HiddenTextItem', 0, 'Left' ); // Left_HiddenTextItem
else if (NodeViewType == 15 ) html_item += BuildTextItemView (Node, Permission, 'HiddenTextItem', 1, 'Left' ); // Param1Left_HiddenTextItem
else if (NodeViewType == 16 ) html_item += BuildTextItemView (Node, Permission, 'SimpleTextItem', 2, 'Left' ); // Param2Left_SimpleTextItem
else if (NodeViewType == 17 ) html_item += BuildTextItemView (Node, Permission, 'SimpleTextItem', 1, 'Right'); // Param1RightSimpleTextItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 30 ) html_item += BuildTextItemView (Node, Permission, 'SimpleLinkItem', 0, 'Left' ); // Left_SimpleLinkItem
else if (NodeViewType == 31 ) html_item += BuildTextItemView (Node, Permission, 'SimpleLinkItem', 1, 'Left' ); // Param1Left_SimpleLinkItem
else if (NodeViewType == 32 ) html_item += BuildTextItemView (Node, Permission, 'SimpleLinkItem', 1, 'Right'); // Param1RightSimpleLinkItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 40 ) html_item += BuildInputItemView (Node, Permission, 0); // InputItem
else if (NodeViewType == 41 ) html_item += BuildInputItemView (Node, Permission, 1); // Param InputItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 50 ) html_item += BuildButtonItemView (Node, Permission); // ButtonItem
else if (NodeViewType == 51 ) html_item += BuildButtonItemView (Node, Permission); // BrotherAuxiliaryButtonItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 60 ) html_item += BuildSimpleBoxView (Node, 'Left', 1, 0); // SimpleBox
else if (NodeViewType == 61 ) html_item += BuildSimpleBoxView (Node, 'Left', 1, 1); // Param Left SimpleBox
else if (NodeViewType == 62 ) html_item += BuildSimpleBoxView (Node, 'Left', 3, 0); // Left3SimpleBox
else if (NodeViewType == 63 ) html_item += BuildSimpleBoxView (Node, 'Right', 3, 0); // Right3SimpleBox
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 70 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'RadioItem', 0); // RadioItem
else if (NodeViewType == 71 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'RadioItem', 1); // Param RadioItem
else if (NodeViewType == 72 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'RadioItem', 2); // Param2 RadioItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 80 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'CheckItem', 0); // CheckItem
else if (NodeViewType == 81 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'CheckItem', 1); // Param CheckItem
else if (NodeViewType == 82 ) html_item += BuildSimpleBoxItemView (Node, Permission, 'CheckItem', 2); // Param2 CheckItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
else if (NodeViewType == 90 ) html_item += BuildListBoxView (Node, Permission, 1, 'FieldSetOff', Align); // ComboListBox
else if (NodeViewType == 91 ) html_item += BuildListBoxView (Node, Permission, 10, 'FieldSetOn' , Align); // ListBox
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//else if (NodeViewType ==100 ) html_item += BuildImageItemView (Node, Permission, Scalability, Align); // ImageItem
//else if (NodeViewType ==101 ) html_item += BuildImageItemView (Node, Permission, 10, 'FieldSetOn' , Align); // ImageItem
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '</label>';
return html_item;
}
//--------------------------------------------------------------------------------------------------------------------
function StrToFormatStr(Str)
{
var NewStr = '';
S = new String(Str);
len = (S.length);
for(i=0;i<len;i++)
if (S.charAt(i) == '|') NewStr=NewStr+'</br>';
else NewStr=NewStr+S.charAt(i);
return NewStr;
}
//--------------------------------------------------------------------------------------------------------------------
function BuildNodeSpecificationView(Node, Class, Mode, NodeViewType)
{
var html_item ='';
if (Mode == 'Caption')
{
if(Node.Method0('M_GetNode'+Mode)=='') return '';
else if (NodeViewType == 'SimpleLinkItem') { html_item += '<div class=\''+Class+'\' id=\''+Node.objID+'Caption'+
'\' onclick="OnNodeLinkItemClick(\''+Node.objID+'\',this)" '+
'onmouseover="OnNodeLinkItemMouseOver(\''+Node.objID+'Caption'+'\',\''+Node.objID+'\', \'SimpleLinkItem\')" '+
' onmouseout="OnNodeLinkItemMouseOut (\''+Node.objID+'Caption'+'\',\''+Node.objID+'\', \'SimpleLinkItem\')">'+
StrToFormatStr(Node.Method0('M_GetNode'+Mode))+'</div>'; }
else if (NodeViewType == 'CheckItem') { html_item += '<div class=\''+Class+'\''+' id=\''+Node.objID+'Caption\''+
' style="margin-right:2px;" onclick="OnSimpleBoxItemValueChange(\''+
Node.objID+'\' ,this , \''+NodeViewType+'\')">'+
StrToFormatStr(Node.Method0('M_GetNode'+Mode))+'</div>'; }
else if (NodeViewType == 'RadioItem') { html_item += '<div class=\''+Class+'\''+' id=\''+Node.objID+'Caption\''+
' style="margin-right:2px;" onclick="OnSimpleBoxItemValueChange(\''+
Node.objID+'\' ,this , \''+NodeViewType+'\')">'+
StrToFormatStr(Node.Method0('M_GetNode'+Mode))+'</div>'; }
else { html_item += '<div class=\''+Class+'\''+' id=\''+Node.objID+'Caption\''+
' style="margin-right:2px;">'+
StrToFormatStr(Node.Method0('M_GetNode'+Mode))+'</div>'; }
}
else if (Mode == 'Description')
{
if(Node.Method0('M_GetNode'+Mode)=='') { return ''; }
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.objID;
var NodeID = Node.objID;
html_item += '<div class=\''+Class+'\''+' id=\''+Node.objID+'Description\''+' >'+StrToFormatStr(Node.Method0('M_GetNode'+Mode))+'</div>';
}
return html_item;
}
//-------------------------------------------------------------------------------------------------------------------------------
// 1. NodeType : InputItem
//-------------------------------------------------------------------------------------------------------------------------------
function BuildInputItemView (Node, Mode, ParamCount)
{
var permission = '';
if (Mode == 'disabled') {permission = 'disabled';}
var html_item = '<table><tbody>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<tr><td width="100%">';
html_item += '<table><tbody><tr>';
if (IsCollapsible(Node) == 'Auto') html_item += '<td width="1%"><img src="Pics/Op_Node_Exp.gif" id=\''+Node.objID+'CEButton\' onclick="OnCollapsibleNodeButtonClick(\''+Node.objID+
'CollapsiblePart'+'\', this)"></td>';
if (IsCollapsible(Node) == 'Manual')html_item += '<td width="1%"><img src="Pics/Op_Node_Blank.gif" onclick="OnCollapsibleNodeButtonClick(\''+Node.objID+
'CollapsiblePart'+'\', this)"></td>';
html_item += '<td width="1%" nowrap>'+BuildNodeSpecificationView(Node, "IBNCD", "Caption", 'InputBox')+'</td>';
html_item += '<td width="100%"><label class="IBNVD">';
// - - - - - - -
if ((Node.Method0('M_GetNodeValue')*0)==0) size = 10; else size = 45;
if ((Node.Method0('M_GetNodeValue'))=='') size = 45;
if (Node.Method0('M_GetNodeName') == 'File_TimeString') size = 15;
if (Node.Method0('M_GetNodeName') == 'change_to_user_location_folder') size = 15;
if (Node.Method0('M_GetNodeName') == 'delete_to_user_location_folder') size = 15;
// - - - - - - -
html_item += '<input type="text" size="'+size+'" value="'+Node.Method0('M_GetNodeValue')+ '" ondblclick="OnInputItemClick(this)" ' + permission +
'onkeydown="OnInputItemKeyDown(event, this, \''+Node.objID+'\')" onkeypress="OnInputItemKeyPressed(event, this, \''+Node.objID+'\')" onblur="SaveInputItemValue(this, \''+Node.objID+'\')" id=\''+Node.objID+'Value'+'\' >';
html_item += '</label></td>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (ParamCount > 0)
{
var count = 0;
child_node = Node.GetFirst();
while ((child_node != null) && (count < ParamCount))
{
if(IsProcessed(child_node))
{
html_item +='<td width="1%">' + BuildNodeView(child_node, 'Left') + '</td>' ;
count ++;
}
child_node = Node.GetNext(child_node);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '</tr></tbody></table>';
html_item += '</td></tr>';
// - - - - - - - - - - - - - - - - - -
html_item += '<tr><td width="100%">'+BuildNodeSpecificationView(Node, "IBNDD", "Description", 'InputBox')+'</td></tr>';
html_item += '<tr><td width="100%">'+BuildAllChildrenView(Node, 'Vertical', ParamCount)+'</td></tr>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item +='</tbody></table>';
return html_item;
}
//-------------------------------------------------------------------------------------------------------------------------------
function OnInputItemClick(HtmlElement)
{
HtmlElement.setActive();
HtmlElement.select();
}
function OnInputItemKeyPressed(evt, HtmlElement, NodeID)
{
if (evt.keyCode == 13) {SaveInputItemValue(HtmlElement, NodeID); return false};
else return true;
}
function SaveInputItemValue(HtmlElement, NodeID)
{
var Node=external.ObjByID(NodeID);
Node.Method1('M_SetNodeValue', HtmlElement.value);
ExtRefreshView(Node, 0);
}
function OnInputItemKeyDown(evt, HtmlElement, NodeID)
{
external.Method2('M_KeyPressed', NodeID, evt.keyCode);
}
//------------------------------------------------------------------------------------------------------
// 2. NodeType : TextItem, SimpleTextItem, SimpleLinkItem
//------------------------------------------------------------------------------------------------------
function BuildTextItemView(Node, Mode, ItemType, ParamCount, Align)
{
var Height = 6;//height="'+Math.round(Height*15)+'"
var level = TitleItemLevel(Node.objID);
if ((ItemType == 'HiddenTextItem') && (level == 1)) ItemType = 'TextItem';
if ((ItemType == 'HiddenTextItem') && (level != 1)) return '';
if ((ItemType == 'SimpleLinkItem') && (level == 1)) ItemType = 'TextItem';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.objID;
var NodeID = Node.objID;
// - - - - - - - - - - - - -
if (ItemType == 'TextItem') if (level > 5) node_class = 'TINCD5'; else node_class = 'TINCD'+level;
else if (ItemType == 'SimpleTextItem') {node_class = 'STINCD';}
else if (ItemType == 'SimpleLinkItem') {node_class = 'SLINCD';}
// - - - - - - - - - - - - -
var permission = '';
if (Mode == 'disabled') {permission = 'disabled';}
//********************************************************************
var html_item = '<table><tbody>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<tr><td';
if (IsCollapsible(Node) != 'No') html_item += ' style="border: 1px solid #555555" ';
html_item += '>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<table><tbody><tr id="'+Node.objID+'Height'+'">';
if (IsCollapsible(Node) == 'Auto') html_item += '<td width="1%" style="border: solid 1px #555555;"><img src="Pics/Op_Node_Exp.gif" id=\''+Node.objID+'CEButton\' onclick="OnCollapsibleNodeButtonClick(\''+Node.objID+
'CollapsiblePart'+'\', this)"></td>';
if (IsCollapsible(Node) == 'Manual')html_item += '<td width="1%"><img src="Pics/Op_Node_Blank.gif" onclick="OnCollapsibleNodeButtonClick(\''+Node.objID+
'CollapsiblePart'+'\', this)"></td>';
if (ParamCount == 0) html_item += '<td width="100%" nowrap>'+BuildNodeSpecificationView(Node, node_class, 'Caption', ItemType)+'</td>';
if (ParamCount > 0)
{
if (Align == 'Center') html_item += '<td width="'+Math.round(100/ParamCount)+'%" nowrap>'+BuildNodeSpecificationView(Node, node_class, 'Caption', ItemType)+'</td>';
if (Align == 'Left' ) html_item += '<td width="200px" nowrap>'+BuildNodeSpecificationView(Node, node_class, 'Caption', ItemType)+'</td>';
if (Align == 'Right' ) html_item += '<td width="100%">'+BuildNodeSpecificationView(Node, node_class, 'Caption', ItemType)+'</td>';
var count = 0;
child_node = Node.GetFirst();
while ((child_node != null) && (count < ParamCount))
{
if(IsProcessed(child_node))
{
if (count < ParamCount-1)
{
if (Align == 'Center') html_item +='<td width="'+Math.round(100/ParamCount)+'%">' + BuildNodeView(child_node, 'Left') + '</td>';
if (Align == 'Left' ) html_item +='<td width="175px" nowrap>' + BuildNodeView(child_node, 'Left') + '</td>';
//if (Align == 'Left' ) html_item +='<td width="1%">' + BuildNodeView(child_node, 'Left') + '</td>';
if (Align == 'Right' ) html_item +='<td width="1%" nowrap>' + BuildNodeView(child_node, 'Left') + '</td>';
}
else
{
html_item +='<td width="1%" nowrap>' + BuildNodeView(child_node, 'Left') + '</td>';
}
count ++;
}
child_node = Node.GetNext(child_node);
}
if (Align == 'Left') html_item +='<td width="1000%">' + '<img src="Pics/Op_Node_Blank.gif">' + '</td>';
}
html_item += '</tr></tbody></table>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '</td></tr>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ((Node.Method0('M_GetNodeDescription') != '') && (Node.Method0('M_GetNodeDescription') != null) && (TitleItemLevel(Node.objID) != 1))
{
html_item += '<tr><td><table><tbody><tr>';
if (ItemType == 'SimpleLinkItem') html_item += '<td width="100%">'+BuildNodeSpecificationView(Node, 'LINDD', 'Description', ItemType)+'</td>';
else html_item += '<td width="100%">'+BuildNodeSpecificationView(Node, 'TINDD', 'Description', ItemType)+'</td>';
html_item += '</tr></tbody></table></td></tr>';
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if((RootNodeID == NodeID) || (ItemType == 'TextItem') || (ItemType == 'SimpleTextItem'))
{
html_item += '<tr><td><table><tbody><tr>';
html_item += '<td width="100%">'+BuildAllChildrenView(Node, 'Vertical', ParamCount)+'</td>';
html_item += '</tr></tbody></table></td></tr>';
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item +='</tbody></table>';
//********************************************************************
return html_item;
}
function OnNodeLinkItemClick(NodeID)
{
var Node=external.ObjByID(NodeID);
external.Method1('M_ShowNode', Node);
}
function OnNodeLinkItemMouseOver(ElementID, NodeID, Mode)
{
var Element = document.getElementById(ElementID);
if (Mode == 'LinkItem')
{
var Node = external.ObjByID(NodeID);
var level = TitleItemLevel(Node.objID);
if (level > 5) Element.className = 'LINCE5';
else Element.className = 'LINCE'+level;
}
else if (Mode == 'SimpleLinkItem') Element.className = 'SLINCE';
}
function OnNodeLinkItemMouseOut(ElementID, NodeID, Mode)
{
var Element = document.getElementById(ElementID);
if (Mode == 'LinkItem')
{
var Node = external.ObjByID(NodeID);
var level = TitleItemLevel(Node.objID);
if (level > 5) Element.className = 'LINCD5';
else Element.className = 'LINCD'+level;
}
else if (Mode == 'SimpleLinkItem') Element.className = 'SLINCD';
}
function TitleItemLevel(NodeID)
{
var result = 1;
var RootNode = external.Method0('M_GetOptionTreeRoot');
var RootNodeID = RootNode.objID;
var Node = external.ObjByID(NodeID);
if(RootNodeID != NodeID)
{
var ParentNode = Node.Method0('M_GetNodeParent');
var ParentNodeID = ParentNode.objID;
var ParentNodeType = ParentNode.Method0('M_GetNodeType');
// if Parent is TextItem or LinkItem
if (((ParentNodeType >= 10) && (ParentNodeType < 30)) ||
(ParentNodeType >= 30) && (ParentNodeType < 40)) result++;
while ((ParentNodeID != RootNodeID))
{
ParentNode = ParentNode.Method0('M_GetNodeParent');
ParentNodeID = ParentNode.objID;
ParentNodeType = ParentNode.Method0('M_GetNodeType');
if (((ParentNodeType >= 10) && (ParentNodeType < 30)) ||
(ParentNodeType >= 30) && (ParentNodeType < 40)) result++;
}
}
return result;
}
//------------------------------------------------------------------------------------------------------
// 3. NodeType : ButtonItem
//------------------------------------------------------------------------------------------------------
function BuildButtonItemView(Node, Mode)
{
if ((Node.Method0('M_GetNodeType') == 51) && (G_PAPAM_NODE_IS_VISIBLE == false)) return '';
var permission = '';
if (Mode == 'disabled') {permission = 'disabled';}
var html_item = '<table><tbody>';
//-----------------------------------------
html_item += '<tr><td><table><tbody><tr>';
if (IsCollapsible(Node) == 'Auto') html_item += '<td width="1%"><img src="Pics/Op_Node_Exp.gif" id=\''+Node.objID+'CEButton\' onclick="OnCollapsibleNodeButtonClick(\''+
Node.objID+'CollapsiblePart'+'\', this)"></td>';
if (IsCollapsible(Node) == 'Manual')html_item += '<td width="1%"><img src="Pics/Op_Node_Blank.gif" onclick="OnCollapsibleNodeButtonClick(\''+
Node.objID+'CollapsiblePart'+'\', this)"></td>';
html_item += '<td width="100%">'+ '<button onclick="OnNodeButtonItemClick(\''+Node.objID+'\')" '+
permission +' title="'+Node.Method0('M_GetNodeCaption')+'" id=\''+Node.objID+'Button'+'\' class="BIND">'+
BuildNodeSpecificationView(Node, 'BINCD', 'Caption', 'ButtonItem')+'</button>'+'</td>';
html_item += '</tr></tbody></table></td></tr>';
//-----------------------------------------
if ((Node.Method0('M_GetNodeDescription') != '') && (Node.Method0('M_GetNodeDescription') != null))
html_item += '<tr><td width="100%">'+BuildNodeSpecificationView(Node, 'BINDD', 'Description', 'ButtonItem')+'</td></tr>';
//-----------------------------------------
html_item += '<tr><td width="100%">'+BuildAllChildrenView(Node, 'Vertical', 0)+'</td></tr>';
//-----------------------------------------
html_item += '</tbody></table>';
return html_item;
}
function OnNodeButtonItemClick(NodeID)
{
var Node=external.ObjByID(NodeID);
Node.Method0('M_ButtonPressed');
}
//------------------------------------------------------------------------------------------------------
// 4. NodeType : ListBox, ListItem
//------------------------------------------------------------------------------------------------------
function BuildListBoxView(Node, Mode ,VSize, FieldSet, Align)
{
var permission = '';
if (Mode == 'disabled') {permission = 'disabled';}
var html_item = '';
var selected ='';
html_item += '<table><tbody><tr><td width="100%">';
//*****************************************************************
if (FieldSet == 'FieldSetOn')
{
html_item += '<fieldset><legend>'+ BuildNodeSpecificationView(Node, 'LBNCD', 'Caption', 'ListBox')+'</legend>';
html_item += '<table width="100%"><tbody><tr><td width="100%">';
// 2 entry #1
html_item += '<select ';
}
else
{
html_item += '<table ><tbody><tr>';
// 2 entry #2
if (Align == 'Left') html_item += '<td width="1%" nowrap>' + BuildNodeSpecificationView(Node, 'LBNCS', 'Caption', 'ListBox') + '</td><td width="100%"><select ';
if (Align == 'Right') html_item += '<td width="100%" nowrap><img src="Pics/Op_Node_Blank.gif"></td><td width="1%" nowrap>' +
'<label align='+Align+'>' + BuildNodeSpecificationView(Node, 'LBNCS', 'Caption', 'ListBox') +'</label>'+
'</td><td width="1%">' + '<select ';
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (VSize > 1)
{
html_item +='size=\''+VSize+'\' class="LBND" ';
html_item +='onchange="OnSimpleBoxItemValueChange(\''+Node.objID+'\',this, \'ListBox\')" '+permission+'>';
}
else html_item +='onchange="OnSimpleBoxItemValueChange(\''+Node.objID+'\',this, \'ComboListBox\')" '+permission+'>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var child_node = Node.GetFirst();
if(child_node != null)
{
var NodeViewType = child_node.Method0('M_GetNodeType');
while(child_node != null)
{
if(NodeViewType == 12) //if SimpleTextItem
{
if ( Node.Method0('M_GetNodeValue') == child_node.Method0('M_GetNodeValue')) {selected ='selected';}
html_item += '<option '+selected+' value=\''+child_node.Method0('M_GetNodeValue')+'\''+
' id=\''+child_node.objID+'\' offsetWidth="8">'+child_node.Method0('M_GetNodeCaption')+'</option>';
selected ='';
}
child_node = Node.GetNext(child_node);
if(child_node != null) NodeViewType = child_node.Method0('M_GetNodeType');
else NodeViewType = 0;
}
}
if (FieldSet == 'FieldSetOn')
{
html_item += '</select></td>';
html_item += '<td width="20%" style="vertical-align:top">';
//--------------------------------------------------------
html_item += '<table><tbody>';
var count = 0;
child_node = Node.GetFirst();
if(child_node != null)
{
NodeViewType = child_node.Method0('M_GetNodeType');
while ((child_node != null) && (count < 4))
{
if(child_node != null) if (NodeViewType != 12) //if is not SimpleTextItem
{
html_item += '<tr><td width="100%" style="vertical-align:top">' + BuildNodeView(child_node, 'Left') + '</td></tr>'; count ++;
if (count == 2 ) html_item += '<tr><td width="100%">' +'<img src="Pics/Op_Node_Blank.gif" >'+ '</td></tr>';
}
child_node = Node.GetNext(child_node);
if(child_node != null) NodeViewType = child_node.Method0('M_GetNodeType');
else NodeViewType = 0;
}
}
html_item += '</tbody></table>';
//--------------------------------------------------------
// 2 exit #1
html_item += '</td></tr></tbody></table>';
}
// 2 exit #2
else html_item += '</select></td><td><img src="Pics/Op_Node_Blank.gif"></td></tr></tbody></table>';
//----------------------------------------------------------------------------------
if ((Node.Method0('M_GetNodeDescription') != '') && (Node.Method0('M_GetNodeDescription') != null))
{
html_item += '<table><tbody><tr><td width="100%">';
html_item += BuildNodeSpecificationView(Node, 'LBNDD', 'Description', 'ListBox');
html_item += '</td></tr></tbody></table>';
}
//----------------------------------------------------------------------------------
html_item += '<table ><tbody><tr><td width="100%">';
if (FieldSet != 'FieldSetOn') child_node = Node.GetFirst();
if(child_node != null)
{
NodeViewType = child_node.Method0('M_GetNodeType');
while(child_node != null)
{
if(child_node != null) if (NodeViewType != 12)
{
html_item += '<table><tbody><tr><td width="100%">'+BuildNodeView(child_node, 'Left')+'</td></tr></tbody></table>';
}
child_node = Node.GetNext(child_node);
if(child_node != null) NodeViewType = child_node.Method0('M_GetNodeType');
else NodeViewType = 0;
}
}
html_item += '</td></tr></tbody></table>';
//------------------------------------------------------------------------------------
if (FieldSet == 'FieldSetOn'){ html_item += '</fieldset>';}
//*****************************************************************
html_item += '</td></tr></tbody></table>';
return html_item;
}
//------------------------------------------------------------------------------------------------------
// 5. NodeType : SimpleBox, RadioItem, CheckItem
//------------------------------------------------------------------------------------------------------
function BuildSimpleBoxView(Node, Align, Rows, ParamCount)
{
var html_item = '<table><tbody><tr><td width="100%">';
html_item += '<div><fieldset width="100%"><legend>'+BuildNodeSpecificationView(Node, 'SBNCD', 'Caption', 'SimpleBox')+'</legend>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<table style="margin-bottom:8px;"><tbody><tr><td width="100%" style="background:#eeeeee;">' +
BuildNodeSpecificationView(Node, 'SBNDD', 'Description', 'SimpleBox') +'</td></tr></tbody></table>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<table><tbody><tr>';
var child_node = Node.GetFirst();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var count = 0;
if(child_node != null)
{
while(child_node != null)
{
if (IsProcessed(child_node))
{
if (Rows == 1) html_item += '<td width=\''+Math.round(100/(Rows))+'%\' nowrap>'+BuildNodeView(child_node, Align)+'</td>';
else html_item += '<td width=\''+Math.round(100/(Rows))+'%\' nowrap>'+BuildNodeView(child_node, Align)+'</td>';
count ++;
}
child_node = Node.GetNext(child_node);
if (child_node != null) if((count % Rows) == 0) html_item +='<td width="100%"><img src="Pics/Op_Node_Blank.gif"></td></tr><tr>';
}
}
if (count > 0)
{
while ((count % Rows) != 0)
{
if (Rows == 1) html_item += '<td width=\''+Math.round(100/(Rows))+'%\'>'+'<img src="Pics/Op_Node_Blank.gif">'+'</td>';
else html_item += '<td width=\''+Math.round(100/(Rows))+'%\'>'+'<img src="Pics/Op_Node_Blank.gif">'+'</td>';
html_item += '<td width="100%">'+'<img src="Pics/Op_Node_Blank.gif">'+'</td>';
count++;
}
html_item +='<td width="100%"><img src="Pics/Op_Node_Blank.gif"></td>';
}
else html_item +='<td width="100%"><img src="Pics/Op_Node_Blank.gif"></td>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '</tr></tbody></table>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if (ParamCount > 0)
{
var ParentNode = Node.Method0('M_GetNodeParent');
var brother_node = ParentNode.GetFirst();
while ((brother_node.objID) != (Node.objID)) brother_node = ParentNode.GetNext(brother_node);
G_PAPAM_NODE_IS_VISIBLE = true;
html_item += '<table><tbody><tr>';
var i = 0;
while ((brother_node != null) && (i < ParamCount))
{
brother_node = ParentNode.GetNext(brother_node);
if(IsProcessed(brother_node))
{
html_item +='<td width=\'1%\'>' + BuildNodeView(brother_node, Align) +'</td>';
i ++;
}
}
html_item += '</tr></tbody></table>';
G_PAPAM_NODE_IS_VISIBLE = false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '</fieldset></div></td></tr></tbody></table>';
return html_item;
}
//------------------------------------------------------------------------------------------------------
function BuildSimpleBoxItemView (Node, Mode, NodeType, ParamCount)
{
var permission = '';
if (Mode == 'disabled') {permission = 'disabled';}
//------------------------------------------------
var ParentNode = Node.Method0('M_GetNodeParent');
var checked ='';
if ((NodeType == 'CheckItem') && (Node.Method0('M_GetNodeValue') == 1)) checked ='checked';
if ((NodeType == 'RadioItem') && (ParentNode.Method0('M_GetNodeValue') == Node.Method0('M_GetNodeValue'))) checked ='checked';
//------------------------------------------------
var BeginChar='';
if (NodeType == 'CheckItem') {BeginChar='C'; InputType='checkbox';}
if (NodeType == 'RadioItem') {BeginChar='R'; InputType='radio'; }
//***************************************************************************************
html_item = '<table><tbody>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<tr><td width="100%">';
html_item += '<table><tbody><tr>';
// - - - - - - -
html_item += '<td width="1%"><input type=' + InputType + ' ' + checked + ' value=\''+Node.Method0('M_GetNodeValue')+
'\' name=\''+Node.objID+'\' id=\''+Node.objID+'SimpleBoxItem\' onclick="OnSimpleBoxItemValueChange(\''+
Node.objID+'\',this, \''+NodeType+'\')" '+permission+' ></td>';
// - - - - - - -
if (IsCollapsible(Node) == 'Auto')
{
html_item += '<td width="1%"><img src="Pics/Op_Node_Exp.gif" id=\''+Node.objID+'CEButton\' onclick="OnCollapsibleNodeButtonClick(\''+
Node.objID+'CollapsiblePart'+'\', this)"></td>';
}
if (IsCollapsible(Node) == 'Manual')
{
html_item += '<td width="1%"><img src="Pics/Op_Node_Blank.gif" onclick="OnCollapsibleNodeButtonClick(\''+
Node.objID+'CollapsiblePart'+'\', this)"></td>';
}
// - - - - - - -
if (ParamCount > 0) html_item += '<td left=20 width="180px" nowrap>'+BuildNodeSpecificationView(Node, (BeginChar + 'INCD'), 'Caption', NodeType)+'</td>';
else html_item += '<td nowrap>'+BuildNodeSpecificationView(Node, (BeginChar + 'INCD'), 'Caption', NodeType)+'</td>';
// - - - - - - -
if (ParamCount > 0)
{
var count = 0;
var child_node = Node.GetFirst();
while ((child_node != null) && (count < ParamCount))
{
if(IsProcessed(child_node))
{
html_item +='<td width="1%" nowrap>' + BuildNodeView(child_node, 'Left') + '</td>' ;
count ++;
}
child_node = Node.GetNext(child_node);
}
}
html_item += '<td width="100%"><img src="Pics/Op_Node_Blank.gif"></td>';
html_item += '</tr></tbody></table>';
html_item += '</td></tr>';
// - - - - - - -
if ((Node.Method0('M_GetNodeDescription') != '') && (Node.Method0('M_GetNodeDescription') != null))
html_item += '<tr><td width="100%">'+BuildNodeSpecificationView(Node, (BeginChar + 'INDD'), 'Description', NodeType)+'</td></tr>';
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
html_item += '<tr><td>'+BuildAllChildrenView(Node, 'Vertical', ParamCount)+'</td></tr>';
//***************************************************************************************
html_item += '</tbody></table>';
return html_item;
}
//---------------------------------------------------------------------------------------------------------------
function OnSimpleBoxItemValueChange(NodeID, CheckItem, Mode)
{
var Node = external.ObjByID(NodeID);
if( Mode == "CheckItem")
{
if ( (Node.Method0('M_GetNodeValue')) == 1) { Node.Method1('M_SetNodeValue', 0); }
else { Node.Method1('M_SetNodeValue', 1); }
ExtRefreshView(Node, 0);
}
else if ((Mode == "RadioItem"))
{
var ParentNode=Node.Method0('M_GetNodeParent');
ParentNode.Method1('M_SetNodeValue', Node.Method0('M_GetNodeValue'));
ExtRefreshView(ParentNode, 0);
}
else if ((Mode == "ComboListBox"))
{
Node.Method1('M_SetNodeValue', CheckItem.value);
//ExtRefreshView(Node, 0);
}
else if ((Mode == "ListBox"))
{
Node.Method1('M_SetNodeValue', CheckItem.value);
}
}
//---------------------------------------------------------------------------------------------------------------
// Not used functions yet
//---------------------------------------------------------------------------------------------------------------